import request from './request'
import { PageDto, PageResDto, InsureCompanyDto } from '@/api/dto'
export interface GetSignDto {
    companyId: number
    companyName: string
    money: number
    productOpenTime: string
    productType: number
    salesName: string
    withoutDeduction: string
    dealId:string
}
// api/v1/crm/sign-contract-record/get-signature
export function getSign (data:PageDto&{productType?:number|string, companyName?:string, sortOrder?:number|string}): Promise<PageResDto<GetSignDto[]>> {
    return request.get('/api/v1/crm/product-deal/get-signature-list', data)
}
export interface GetInsureDto {
    productOpenTime:{
        productOpenTime: string
        remark: string
        updateSalerTime: string
    },
    wesureInfo:{
        companyName: string
        saleId: number
        salesName: string
        serviceStage: string
        serviceState: number
    },
    relevantContacts: string[]
}
// 日日保详情信息
export function getInsure (data:{companyId?:number, dealId:string}): Promise<GetInsureDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-wesure-sign-details', data)
}

// 日日保统计数据
export function getInsureStatistics (data:any): Promise<{amount:number, policyPeopleCount:number, recordCount:number}> {
    return request.get('/api/v1/crm/sign-contract-record/wesure-operation-data', data)
}

// 日日保统计 图表数据
export function getInsureChart (data:any): Promise<{programme:string, premium:number}[]> {
    return request.get('/api/v1/crm/sign-contract-record/get-company-wesure-programme', data)
}

// 日日报保司列表
export function getInsureCompany (type:any): Promise<InsureCompanyDto[]> {
    return request.get('/api/v1/crm/sign-contract-record/insure-company?type=' + type)
}

// 日日保方案列表
export function getInsureProgramme (data:any): Promise<string[]> {
    return request.get('/api/v1/crm/sign-contract-record/get-wesure-programme', data)
}

// 长期保详情数据
export function getLongInsureInfo (data:{
    companyId:number
    dealId:string
}): Promise<GetInsureDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-period-sign-details', data)
}

// 签单长期保详情总保费
export function totalPremium (data:{
    companyId:number
    insurCompany:string
    insurCompanyPlanCode:string
    insuranceMethod:number | string
    startTime:string
    endTime:string
}): Promise<any> {
    return request.get('/api/v1/crm/sign-contract-record/get-period-premium-count', data)
}

// 签单长期保进七天数据
export function nearlySevenDays (data:{
    companyId:number
}): Promise<{date:string[], add:string[], reduce:string[]}> {
    return request.get('/api/v1/crm/sign-contract-record/get-period-sign-seven-days', data)
}

// 签单长期保人数饼图
export function insurancePiePeople (data:{
    companyId:number
    queryMonth:string
}): Promise<any> {
    return request.get('/api/v1/crm/sign-contract-record/get-risk-category-count-by-number', data)
}
//
export function insurancePieMoney (data:{
    companyId:number
    queryMonth:string
}): Promise<any> {
    return request.get('/api/v1/crm/sign-contract-record/get-risk-category-count-by-money', data)
}
// 长期保险保司列表
export function insuranceCompanyList (data:{
    companyId:number
}): Promise<any> {
    return request.get('/api/v1/crm/sign-contract-record/get-company-insurance-company', data)
}

// 长期保发案列表
export function insuranceSendList (data:{
    companyId:number
}): Promise<any> {
    return request.get('/api/v1/crm/sign-contract-record/get-period-plans', data)
}

// 长期保加减保数据
export function insuranceOtherData (data:{
    companyId:number
}): Promise<any> {
    return request.get('/api/v1/crm/sign-contract-record/get-period-details-other-data', data)
}

// 长期保加减保数据
export function insurancePreparation (data:{
  companyId?:number,
}): Promise<any> {
  return request.get('/api/v1/crm/sign-contract-record/get-insur-mode', data)
}

// 长期保加减保数据
export function insurancePlusMinus (data:{
  companyId:number,
  type:number | string,
  pageNum:number,
  pageSize:number
}): Promise<any> {
  return request.get('/api/v1/crm/sign-contract-record/get-period-add-and-subtract-record', data)
}

// 长期保 日日保 充值记录 查询  type来区分 0:日日保,1:长期保
export function insuranceRechargeRecord (data:{
  companyId:number,
  pageNum: number,
  pageSize: number,
  type: number,
}): Promise<any> {
  return request.get('/api/v1/crm/sign-contract-record/get-wesure_account_balance_record', data)
}

export interface GetPayInfoDto {
    eleSignInfo:{
        companyName: string
        saleId: number
        salesName: string
        serviceState: number
    }
    openPayTime:{
        productOpenTime: string
        remark: string
        updateSalerTime: string
    }
    relevantContacts:[]
}
// 子弹发薪详情数据
export function payInfoData (data:{
    companyId:number
    dealId:string
}): Promise<GetPayInfoDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-pay-sign-details', data)
}
export interface GetPaySaleDto {
    accountExpireTime: string
    currentBalance: number
    openingAmount: number
    payDate: string
    payMode: string
    serviceAmount: number
    status: number
    operationTime:string
    salesScenario:string
    scenario:number
    openAccountMoney:string | null
    totalAmount:number | null
    dueDate:string | null
}
// 子弹发薪销售记录
export function paySaleData (data:{
    companyId:number
}): Promise<GetPaySaleDto[]> {
    return request.get('/api/v1/crm/sign-contract-record/get-pay-sales-record', data)
}
export interface GetpayOperateDto {
    payOperate:{
        payCount: number
        payMoney: number
        paidCount: number
        paidMoney: number
    }
    projectCount:{
        dailyProjectCount: number
        longTimeProjectCount:number
        pcProjectCount: number
        quickProjectCount:number
    }
}
export function payOperateInfo (data:{
    companyId:number
    startTime:string
    endTime:string
}): Promise<GetpayOperateDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-pay-count', data)
}
export interface GetpayOperateEchartsDto {
    date:string[]|number[]
    employees:string[]|number[]
    receivePeople:string[]|number[]
    salaryAmount:string[]|number[]
}
// 签单发薪图表数据
export function payOperateEcharts (data:{
    companyId:number,
    days:number
}): Promise<GetpayOperateEchartsDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-employees-unpaid', data)
}
export interface GetElectronInfoDto {
    info:{
        companyName: string
        saleId: number
        salesName: string
        serviceState: number
    }
    time:{
        productOpenTime: string
        remark: string
        updateSalerTime: string
    }
    crmCustomContacts: string[]
}
// 电子签详细信息
export function electronInfoData (data:{
    companyId:number
    dealId:string
}): Promise<GetElectronInfoDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-ele-sign-details', data)
}
export interface GetElectronRechargeDto {
    createTime: string
    payMoney: number
    rechargeAmount: number
    source: string
}
// 电子签充值记录
export function electronRechargeData (data:{
    companyId:number
}): Promise<GetElectronRechargeDto[]> {
    return request.get('/api/v1/crm/sign-contract-record/get-ele-sign-recharge-record', data)
}
export interface GetElectronOperateDto {
    notSign: number
    openCustomer: number
    sign: number
    signingFailed: number
    surplus: number
}
// 电子签运营数据
export function electronOperateData (data:{
    companyId:number
    startTime:string
    endTime:string
}): Promise<GetElectronOperateDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-ele-sign-operate-data', data)
}

export interface GetElectronChartDto {
    day:string[],
    signingFailed:string[]|number[],
    signQuantity:string[]|number[],
    toBeSigned:string[]|number[]
}
// 电子签 图表数据
export function electronChartData (data:{
    companyId:number
}): Promise<GetElectronChartDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-ele-sign-nearly-seven', data)
}
export interface GetSignStartListDto {
    money: number
    openTime: string
    productName: string
    saleName: string
    withoutDeduction: number
}
export interface GetSignStartDto {
    headInfo:{
        companyName:string
        staffCount:number
    }
    lable:string[]
    list:GetSignStartListDto[]
}

// 签单详情开头列表
export function signStartList (data:{
    companyId:number
}): Promise<GetSignStartDto> {
    return request.get('/api/v1/crm/sign-contract-record/get-sign-customer-details', data)
}
